package design.mode.effective_java.chapter8.item52;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ZhongMingde on 2021/8/31
 */
// 重载方法的选择是静态的，而覆盖法的选择是动态的
public class Overriding {
    public static void main(String[] args) {
        List<Wine> wineList = new ArrayList<>();
        wineList.add(new Wine());
        wineList.add(new SparklingWine());
        wineList.add(new Champagne());
        for (Wine wine : wineList) {
            System.out.println(wine.name());
        }
    }
}
